package com.example.administrator.mvp.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.administrator.mvp.base.i.IBasePresenter;
/**
 * 基础Activity，根据需求来自定义这个父类的通用属性和方法
 */
public class BaseActivity<P extends IBasePresenter> extends AppCompatActivity {
    public P presenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    /**
     * 显示加载对话框
     */
    public void showLoadingView() {
        //可以在这里模拟网络加载时的loading对话框
    }

    /**
     * 隐藏加载对话框
     */
    public void hideLoadingView() {

    }

    /**
     * 重新登录
     */
    public void reLogin() {

    }

    @Override
    protected void onResume() {
        super.onResume();
        presenter.subscribe();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.unsubscribe();
    }
}
